{% extends "base.html" %}

{% block title %}交易监控系统配置 - 交易监控系统{% endblock %}

{% block content %}
<div class="page-header">
    <h1>交易监控系统配置</h1>
</div>

<div class="card">
    <div class="card-header">
        <h2>配置列表</h2>
    </div>
    <div class="card-body">
        <div class="table-container">
            <table>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>配置键</th>
                        <th>配置值</th>
                        <th>描述</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for config in configs %}
                    <tr>
                        <td>{{ config.id }}</td>
                        <td>{{ config.key }}</td>
                        <td>
                            {% if config.value == 'on' %}
                            <span class="badge badge-success">开启</span>
                            {% elif config.value == 'off' %}
                            <span class="badge badge-warning">关闭</span>
                            {% else %}
                            {{ config.value }}
                            {% endif %}
                        </td>
                        <td>{{ config.description }}</td>
                        <td>{{ config.updated_at }}</td>
                        <td>
                            {% if request.state.user_type in ['super_admin', 'admin'] %}
                            <a href="/config/{{ config.id }}/edit" class="btn btn-secondary btn-sm">
                                <i class="fas fa-edit"></i> 编辑
                            </a>
                            {% else %}
                            <span class="text-muted">无权限</span>
                            {% endif %}
                        </td>
                    </tr>
                    {% else %}
                    <tr>
                        <td colspan="6" style="text-align: center;">暂无配置数据</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}